/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * informacionDoctor.java
 *
 * Created on 24-nov-2010, 18:33:04
 */

package GUI.clinica;

import GUI.clinica.clinica;
import javax.swing.JOptionPane;
import cprincipal.*;
import Persistencia.*;
import venehealthfinal.Validar;

/**
 *
 * @author RafaelGutierrez
 */
public class informacionDoctor extends javax.swing.JFrame {

    /** Creates new form informacionDoctor */
     private boolean resultado = false;
    DoctorXml datosDoct=new DoctorXml();
    
    public informacionDoctor(Doctor doct) {

        initComponents();
        TxtNombre.setText(doct.getNombre());
        TxtApellido.setText(doct.getApellido());
        TxtAnioNac.setText(doct.getAnionac());
        TxtCedula.setText(Integer.toString(doct.getCedula()));
        TxtAnioNac.setText(Integer.toString(doct.getAnioexperiencia()));
        TxtEspecialidad.setText(doct.getEspecialidad());
        TxtEstudiosEspeciales.setText(doct.getEstudioespeciales());
        TxtNumeroColegiatura.setText(doct.getNumerocolegitura());
        TxtUniversidadEgreso.setText(doct.getUniversidadegreso());
        TxtTelefono.setText(doct.getTelefono());
        TxtDireccion.setText(doct.getDireccion());

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        LabelNombre = new javax.swing.JLabel();
        LabelApellido = new javax.swing.JLabel();
        LabelCedula = new javax.swing.JLabel();
        LabelTelefono = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        TxtNombre = new javax.swing.JTextField();
        TxtApellido = new javax.swing.JTextField();
        TxtCedula = new javax.swing.JTextField();
        TxtTelefono = new javax.swing.JTextField();
        jPanel2 = new javax.swing.JPanel();
        LabelAnioNacimiento = new javax.swing.JLabel();
        TxtAnioNac = new javax.swing.JTextField();
        LabelLocalidad = new javax.swing.JLabel();
        ComboBoxLocalidad = new javax.swing.JComboBox();
        LabelNumeroColegiatura = new javax.swing.JLabel();
        LabelUniversidadEgreso = new javax.swing.JLabel();
        LabelEstudiosEspeciales = new javax.swing.JLabel();
        LabelEspecialidad = new javax.swing.JLabel();
        TxtUniversidadEgreso = new javax.swing.JTextField();
        TxtEstudiosEspeciales = new javax.swing.JTextField();
        TxtEspecialidad = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        TxtAniosExperiencia = new javax.swing.JTextField();
        TxtNumeroColegiatura = new javax.swing.JTextField();
        LabelHoraEntrada = new javax.swing.JLabel();
        LabelHoraSalida = new javax.swing.JLabel();
        LabelDisponible = new javax.swing.JLabel();
        ComboBoxDisponible = new javax.swing.JComboBox();
        ComboBoxHoraEntrada = new javax.swing.JComboBox();
        ComboBoxHoraSalida = new javax.swing.JComboBox();
        TxtDireccion = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jComboBox1 = new javax.swing.JComboBox();
        jPanel3 = new javax.swing.JPanel();
        BotonEliminar = new javax.swing.JButton();
        BotonAgregar = new javax.swing.JButton();
        BotonRegresar = new javax.swing.JButton();
        BotonModificar = new javax.swing.JButton();
        BotonBuscar = new javax.swing.JButton();
        jPanel4 = new javax.swing.JPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabel1.setForeground(new java.awt.Color(204, 0, 0));
        jLabel1.setText("Informacion de Doctor");

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos Personales"));
        jPanel1.setEnabled(false);

        LabelNombre.setText("Nombre:");

        LabelApellido.setText("Apellido:");

        LabelCedula.setText("Cedula:");

        LabelTelefono.setText("Telefono:");

        jLabel7.setText("Direccion:");

        TxtNombre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TxtNombreActionPerformed(evt);
            }
        });

        TxtCedula.setEditable(false);

        TxtTelefono.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TxtTelefonoActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 516, Short.MAX_VALUE)
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 46, Short.MAX_VALUE)
        );

        LabelAnioNacimiento.setText("Año de Nacimiento:");

        LabelLocalidad.setText("Localidad:");

        ComboBoxLocalidad.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "-", "Zulia", "Tachira", "Merida", "Trujillo", "Apure", "Barinas", "Portuguesa", "Lara", "Falcon", "Yaracuy", "Cojedes", "Carabobo", "Dto. Capital", "Vargas", "Miranda", "Guarico", "Anzoategui", "Bolivar ", "Amazonas", "Monagas", "Delta Amacuro", "Sucre" }));

        LabelNumeroColegiatura.setText("Num. de Colegiatura:");

        LabelUniversidadEgreso.setText("Universidad de Egreso:");

        LabelEstudiosEspeciales.setText("Estudios Especiales:");

        LabelEspecialidad.setText("Especialidad:");

        jLabel14.setText("Años de Experiencia:");

        LabelHoraEntrada.setText("Hora Entrada:");

        LabelHoraSalida.setText("Hora Salida:");

        LabelDisponible.setText("Disponibilidad:");

        ComboBoxDisponible.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "-", "Si", "No" }));
        ComboBoxDisponible.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ComboBoxDisponibleActionPerformed(evt);
            }
        });

        ComboBoxHoraEntrada.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "-", "7:00 am", "8:00 am", "9:00 am", "10:00 am", "11:00 am", "12:00 pm", "1:00 pm", "2:00 pm", "3:00 pm", "4:00 pm", "5:00 pm", "6:00 pm ", "7:00 pm", "8:00 pm", "9:00 pm ", "10:00 pm", "11:00 pm", "12:00 am", "1:00 am", "2:00 am", "3:00 am", "4:00 am", "5:00 am", "6:00 am" }));

        ComboBoxHoraSalida.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "-", "7:00 am", "8:00 am", "9:00 am", "10:00 am", "11:00 am", "12:00 pm", "1:00 pm", "2:00 pm", "3:00 pm", "4:00 pm", "5:00 pm", "6:00 pm ", "7:00 pm", "8:00 pm", "9:00 pm ", "10:00 pm", "11:00 pm", "12:00 am", "1:00 am", "2:00 am", "3:00 am", "4:00 am", "5:00 am", "6:00 am" }));

        jLabel2.setText("Infraestructura:");

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "-", "Clinica Los Naranjos", "Ambulatorio El Hatillo", "Ambulatorio Los Pomelos", "Clinica El Trigal", "Ambulatorio Maria Jose", "Ambulatorio San Antonio" }));

        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(LabelUniversidadEgreso)
                            .add(LabelEstudiosEspeciales)
                            .add(jPanel1Layout.createSequentialGroup()
                                .add(jLabel14)
                                .add(18, 18, 18)
                                .add(TxtAniosExperiencia, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 104, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
                                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel1Layout.createSequentialGroup()
                                        .add(LabelEspecialidad)
                                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                        .add(TxtEspecialidad, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 202, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                        .add(96, 96, 96)
                                        .add(jLabel2)
                                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                                        .add(jComboBox1, 0, 224, Short.MAX_VALUE))
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel1Layout.createSequentialGroup()
                                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                            .add(LabelTelefono)
                                            .add(jLabel7))
                                        .add(32, 32, 32)
                                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                            .add(jPanel1Layout.createSequentialGroup()
                                                .add(TxtTelefono, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 180, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 446, Short.MAX_VALUE))
                                            .add(TxtDireccion, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 626, Short.MAX_VALUE)))
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel1Layout.createSequentialGroup()
                                        .add(LabelAnioNacimiento)
                                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                        .add(TxtAnioNac, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 118, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel1Layout.createSequentialGroup()
                                        .add(LabelLocalidad)
                                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                        .add(ComboBoxLocalidad, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel1Layout.createSequentialGroup()
                                        .add(LabelNumeroColegiatura)
                                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                                            .add(org.jdesktop.layout.GroupLayout.LEADING, TxtUniversidadEgreso)
                                            .add(org.jdesktop.layout.GroupLayout.LEADING, TxtNumeroColegiatura, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 311, Short.MAX_VALUE)
                                            .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel1Layout.createSequentialGroup()
                                                .add(2, 2, 2)
                                                .add(TxtEstudiosEspeciales))))
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel1Layout.createSequentialGroup()
                                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                            .add(LabelCedula)
                                            .add(LabelApellido))
                                        .add(14, 14, 14)
                                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                            .add(jPanel1Layout.createSequentialGroup()
                                                .add(TxtCedula, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 144, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                                .add(201, 201, 201)
                                                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                                    .add(jPanel1Layout.createSequentialGroup()
                                                        .add(LabelDisponible)
                                                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                                        .add(ComboBoxDisponible, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                                    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                                                        .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel1Layout.createSequentialGroup()
                                                            .add(LabelHoraSalida)
                                                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                            .add(ComboBoxHoraSalida, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                                        .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel1Layout.createSequentialGroup()
                                                            .add(LabelHoraEntrada)
                                                            .add(11, 11, 11)
                                                            .add(ComboBoxHoraEntrada, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
                                                .add(95, 95, 95))
                                            .add(TxtApellido, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 652, Short.MAX_VALUE)))
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel1Layout.createSequentialGroup()
                                        .add(LabelNombre)
                                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                                        .add(TxtNombre, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 654, Short.MAX_VALUE)))
                                .add(662, 662, 662))))
                    .add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(LabelNombre)
                    .add(TxtNombre, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(LabelApellido)
                    .add(TxtApellido, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(18, 18, 18)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                            .add(jPanel1Layout.createSequentialGroup()
                                .add(LabelCedula, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .add(12, 12, 12))
                            .add(jPanel1Layout.createSequentialGroup()
                                .add(TxtCedula, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)))
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                            .add(LabelAnioNacimiento)
                            .add(TxtAnioNac, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(18, 18, 18)
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(LabelLocalidad)
                            .add(ComboBoxLocalidad, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                            .add(ComboBoxHoraEntrada, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(LabelHoraEntrada))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(LabelHoraSalida)
                            .add(ComboBoxHoraSalida, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(10, 10, 10)
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(LabelDisponible)
                            .add(ComboBoxDisponible, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(LabelNumeroColegiatura)
                    .add(TxtNumeroColegiatura, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(LabelUniversidadEgreso)
                    .add(TxtUniversidadEgreso, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(LabelEstudiosEspeciales)
                    .add(TxtEstudiosEspeciales, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(LabelEspecialidad)
                    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(TxtEspecialidad, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(jLabel2)
                        .add(jComboBox1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel14)
                    .add(TxtAniosExperiencia, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(18, 18, 18)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(LabelTelefono)
                    .add(TxtTelefono, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(24, 24, 24)
                        .add(jLabel7)
                        .add(34, 34, 34)
                        .add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(jPanel1Layout.createSequentialGroup()
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(TxtDireccion, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .add(120, 120, 120))
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Opciones"));

        BotonEliminar.setText("Eliminar");
        BotonEliminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonEliminarActionPerformed(evt);
            }
        });

        BotonAgregar.setText("Agregrar");
        BotonAgregar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonAgregarActionPerformed(evt);
            }
        });

        BotonRegresar.setText("Regresar");
        BotonRegresar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonRegresarActionPerformed(evt);
            }
        });

        BotonModificar.setText("Modificar Datos");
        BotonModificar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonModificarActionPerformed(evt);
            }
        });

        BotonBuscar.setText("Buscar");

        org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel3Layout.createSequentialGroup()
                .add(BotonEliminar)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(BotonAgregar)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(BotonRegresar)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(BotonModificar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 133, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(BotonBuscar))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel3Layout.createSequentialGroup()
                .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(BotonEliminar)
                    .add(BotonAgregar)
                    .add(BotonRegresar)
                    .add(BotonModificar)
                    .add(BotonBuscar))
                .addContainerGap(9, Short.MAX_VALUE))
        );

        org.jdesktop.layout.GroupLayout jPanel4Layout = new org.jdesktop.layout.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 100, Short.MAX_VALUE)
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 100, Short.MAX_VALUE)
        );

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .addContainerGap()
                        .add(jLabel1))
                    .add(layout.createSequentialGroup()
                        .add(264, 264, 264)
                        .add(jPanel4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(layout.createSequentialGroup()
                        .addContainerGap()
                        .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 751, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(67, Short.MAX_VALUE))
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .addContainerGap(153, Short.MAX_VALUE)
                .add(jPanel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(146, 146, 146))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(jLabel1)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 522, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(18, 18, 18)
                .add(jPanel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 66, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 95, Short.MAX_VALUE)
                .add(jPanel4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(41, 41, 41))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void clearScreen(){

    TxtAnioNac.setText("");
    TxtAniosExperiencia.setText("");
    TxtApellido.setText("");
    TxtEspecialidad.setText("");
    TxtEstudiosEspeciales.setText("");
    ComboBoxHoraEntrada.setSelectedItem("-");
    ComboBoxHoraSalida.setSelectedItem("-");
    ComboBoxLocalidad.setSelectedItem("-");
    ComboBoxDisponible.setSelectedItem("-");
    TxtNombre.setText("");
    TxtNumeroColegiatura.setText("");
    TxtUniversidadEgreso.setText("");
    TxtTelefono.setText("");
    TxtDireccion.setText("");


    }
    private void BotonRegresarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonRegresarActionPerformed
        // TODO add your handling code here:
        clinica ventana=new clinica();
        ventana.setVisible(true);
        this.dispose();
}//GEN-LAST:event_BotonRegresarActionPerformed

    private void BotonModificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonModificarActionPerformed
        // TODO add your handling code here:
        if (TxtCedula.getText().isEmpty()) {
            JOptionPane.showMessageDialog(null, "Por favor indique la cédula", "Error falta cédula", JOptionPane.ERROR_MESSAGE);
        } else {
            int valor = Validar.ValidarEntero(TxtCedula.getText(), "Cédula no es numérica");
            if (valor == 1) {
                Doctor doct = datosDoct.buscarDoctor(Integer.parseInt(TxtCedula.getText()));
                if (doct == null) {
                    JOptionPane.showMessageDialog(null, "Doctor no Existe", "Error cédula no encontrada", JOptionPane.ERROR_MESSAGE);
                    clearScreen();
                    TxtCedula.setEnabled(true);
                    TxtCedula.setText("");
                } else {
                    TxtCedula.setEnabled(false);
                    /*if (TxtNombre.getText().isEmpty() || TxtApellido.getText().isEmpty() || TxtAnioNac.getText().isEmpty() || TxtLocalidad.getText().isEmpty() ||
                        TxtNumeroColegiatura.getText().isEmpty() || TxtUniversidadEgreso.getText().isEmpty() || TxtEstudiosEspeciales.getText().isEmpty() ||
                        TxtEspecialidad.getText().isEmpty() || TxtAniosExperiencia.getText().isEmpty() || TxtDisponibilidad.getText().isEmpty() || 
                        TxtHoraEntrada.getText().isEmpty()|| TxtHoraSalida.getText().isEmpty() ) {

                                JOptionPane.showMessageDialog(null, "Por favor indique los datos completos", "Error faltan Datos", JOptionPane.ERROR_MESSAGE);
                    } else {
                        int valor2 = Validar.ValidarEntero(TxtAniosExperiencia.getText(),"Eficiencia no posee el formato apropiado");
            if (valor2 == 1) {*/
                doct.setNombre(TxtNombre.getText());
                doct.setApellido(TxtApellido.getText());
                doct.setAnionac(TxtAnioNac.getText());
                doct.setLocalidad(ComboBoxLocalidad.getName());
                doct.setNumerocolegitura(TxtNumeroColegiatura.getText());
                doct.setUniversidadegreso(TxtUniversidadEgreso.getText());
                doct.setEstudioespeciales(TxtEstudiosEspeciales.getText());
                doct.setEspecialidad(TxtEspecialidad.getText());
                doct.setAnioexperiencia(Integer.parseInt(TxtAniosExperiencia.getText()));
                doct.setDisponible(ComboBoxDisponible.getName());
                doct.setHoraentrada(ComboBoxHoraEntrada.getName());
                doct.setHorasalida(ComboBoxHoraSalida.getName());
                doct.setTelefono(TxtTelefono.getText());
                doct.setDireccion(TxtDireccion.getText());
                System.out.println("No actualiza doctor");
                datosDoct.actualizarDoctor(doct);
                System.out.println("Ahora si modifica doctor");
                JOptionPane.showMessageDialog(null, "Doctor " + TxtNombre.getText() + " " + TxtApellido.getText(), " modificado con exito!", JOptionPane.INFORMATION_MESSAGE);
                System.out.println("Antes de borrar");
                clearScreen();
                System.out.println("luego de borrar");
                TxtCedula.isEnabled();
                TxtCedula.isEditable();
                

                }
        
                
            }
        }

}//GEN-LAST:event_BotonModificarActionPerformed

    private void TxtTelefonoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TxtTelefonoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_TxtTelefonoActionPerformed

    private void ComboBoxDisponibleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ComboBoxDisponibleActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_ComboBoxDisponibleActionPerformed

    private void BotonAgregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonAgregarActionPerformed
        // TODO add your handling code here:
        String localidad =(String) ComboBoxLocalidad.getSelectedItem();
        String disponibilidad = (String) ComboBoxDisponible.getSelectedItem();
        String horaEntrada = (String) ComboBoxHoraEntrada.getSelectedItem();
        String horaSalida = (String) ComboBoxHoraSalida.getSelectedItem();
        String infraestructura = (String) "";
        Doctor doct = new Doctor( TxtNombre.getText(), TxtApellido.getText(), Integer.parseInt(TxtCedula.getText()) , TxtAnioNac.getText(), localidad, TxtTelefono.getText(), TxtDireccion.getText(), TxtNumeroColegiatura.getText(), TxtUniversidadEgreso.getText(), TxtEstudiosEspeciales.getText(), TxtEspecialidad.getText(), Integer.parseInt(TxtAniosExperiencia.getText()), disponibilidad, horaEntrada, horaSalida, infraestructura);
                    resultado = datosDoct.agregarDoctor(doct);
                    if (resultado == true) {
                        JOptionPane.showMessageDialog(null, "Doctor " + TxtNombre.getText() + " " + TxtApellido.getText(), " agregado con exito!", JOptionPane.INFORMATION_MESSAGE);
                        clearScreen();
                        TxtCedula.setText("");
                    } else {
                        if (doct != null) {
                            JOptionPane.showMessageDialog(null, "Operacion Fallida", "Error", JOptionPane.ERROR_MESSAGE);
                        }
                    }
    }//GEN-LAST:event_BotonAgregarActionPerformed

    
    private void BotonEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonEliminarActionPerformed
        // TODO add your handling code here:

        if (TxtCedula.getText().isEmpty()){ /*&& (!TxtNombre.getText().isEmpty()) && (!TxtApellido.getText().isEmpty()) && (!TxtAnioNac.getText().isEmpty()) && (!TxtLocalidad.getText().isEmpty()) && (!TxtNumeroColegiatura.getText().isEmpty()) && (!TxtUniversidadEgreso.getText().isEmpty()) && (!TxtEstudiosEspeciales.getText().isEmpty()) && (!TxtEspecialidad.getText().isEmpty()) && (!TxtDisponibilidad.getText().isEmpty()) && (!TxtHoraEntrada.getText().isEmpty()) && (!TxtHoraSalida.getText().isEmpty())*/
            JOptionPane.showMessageDialog(null, "Error, campo invalidos", "Debe indicar un numero de cedula valido", JOptionPane.ERROR_MESSAGE);
        } else {
            int valor = Validar.ValidarEntero(TxtCedula.getText(), "Cédula no es numérica");
            if (valor == 1) {
               Doctor doct = datosDoct.buscarDoctor(Integer.parseInt(TxtCedula.getText()));
                if (doct == null) {
                  JOptionPane.showMessageDialog(null, "Estudiante no Existe", "Error cédula no encontrada", JOptionPane.ERROR_MESSAGE);
                } else {

                    TxtNombre.setText(doct.getNombre());
                    TxtApellido.setText(doct.getApellido());
                    TxtCedula.setText(String.valueOf(doct.getCedula()));
                    TxtAnioNac.setText(doct.getAnionac());
                    ComboBoxLocalidad.setVisible(false);
                    LabelLocalidad.setVisible(false);
                    TxtNumeroColegiatura.setText(doct.getNumerocolegitura());
                    TxtUniversidadEgreso.setText(doct.getUniversidadegreso());
                    TxtEstudiosEspeciales.setText(doct.getEstudioespeciales());
                    TxtEspecialidad.setText(doct.getEspecialidad());
                    TxtAniosExperiencia.setText(String.valueOf(doct.getAnioexperiencia()));
                    ComboBoxDisponible.setVisible(false);
                    LabelDisponible.setVisible(false);
                    TxtTelefono.setText(doct.getTelefono());
                    TxtDireccion.setText(doct.getDireccion());
                    int conf= JOptionPane.showOptionDialog(
                            null, "¿Desea Realizar La Operación?", "::::...Confirmación...:::",
                            JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
                    if (conf == 0) {
                        datosDoct.borrarDoctor(Integer.parseInt(TxtCedula.getText()));
                        clearScreen();
                        TxtCedula.setText("");
                    }
                }
        }
        }
    }//GEN-LAST:event_BotonEliminarActionPerformed

    private void TxtNombreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TxtNombreActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_TxtNombreActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
               // Doctor doct = new Doctor();
               // new informacionDoctor(doct).setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BotonAgregar;
    private javax.swing.JButton BotonBuscar;
    private javax.swing.JButton BotonEliminar;
    private javax.swing.JButton BotonModificar;
    private javax.swing.JButton BotonRegresar;
    private javax.swing.JComboBox ComboBoxDisponible;
    private javax.swing.JComboBox ComboBoxHoraEntrada;
    private javax.swing.JComboBox ComboBoxHoraSalida;
    private javax.swing.JComboBox ComboBoxLocalidad;
    private javax.swing.JLabel LabelAnioNacimiento;
    private javax.swing.JLabel LabelApellido;
    private javax.swing.JLabel LabelCedula;
    private javax.swing.JLabel LabelDisponible;
    private javax.swing.JLabel LabelEspecialidad;
    private javax.swing.JLabel LabelEstudiosEspeciales;
    private javax.swing.JLabel LabelHoraEntrada;
    private javax.swing.JLabel LabelHoraSalida;
    private javax.swing.JLabel LabelLocalidad;
    private javax.swing.JLabel LabelNombre;
    private javax.swing.JLabel LabelNumeroColegiatura;
    private javax.swing.JLabel LabelTelefono;
    private javax.swing.JLabel LabelUniversidadEgreso;
    private javax.swing.JTextField TxtAnioNac;
    private javax.swing.JTextField TxtAniosExperiencia;
    private javax.swing.JTextField TxtApellido;
    private javax.swing.JTextField TxtCedula;
    private javax.swing.JTextField TxtDireccion;
    private javax.swing.JTextField TxtEspecialidad;
    private javax.swing.JTextField TxtEstudiosEspeciales;
    private javax.swing.JTextField TxtNombre;
    private javax.swing.JTextField TxtNumeroColegiatura;
    private javax.swing.JTextField TxtTelefono;
    private javax.swing.JTextField TxtUniversidadEgreso;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    // End of variables declaration//GEN-END:variables

}
